using RiceShop.Models;

namespace RiceShop.Services
{
    /// <summary>
    /// Paylinks支付服务接口
    /// </summary>
    public interface IPaylinksPaymentService
    {
        /// <summary>
        /// 创建小程序支付订单
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <param name="userId">用户ID</param>
        /// <param name="openId">用户OpenId</param>
        /// <returns>支付信息</returns>
        Task<PaymentInfo> CreateMiniProgramPaymentAsync(string orderNo, long userId, string openId);

        /// <summary>
        /// 创建APP支付订单
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <param name="userId">用户ID</param>
        /// <returns>支付信息</returns>
        Task<PaymentInfo> CreateAppPaymentAsync(string orderNo, long userId);

        /// <summary>
        /// 创建H5支付订单
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <param name="userId">用户ID</param>
        /// <param name="clientIp">客户端IP</param>
        /// <returns>支付信息</returns>
        Task<PaymentInfo> CreateH5PaymentAsync(string orderNo, long userId, string clientIp);

        /// <summary>
        /// 创建支付宝APP支付订单
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <param name="userId">用户ID</param>
        /// <returns>支付信息</returns>
        Task<PaymentInfo> CreateAlipayAppPaymentAsync(string orderNo, long userId);

        /// <summary>
        /// 创建支付宝H5支付订单
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <param name="userId">用户ID</param>
        /// <param name="clientIp">客户端IP</param>
        /// <returns>支付信息</returns>
        Task<PaymentInfo> CreateAlipayH5PaymentAsync(string orderNo, long userId, string clientIp);

        /// <summary>
        /// 处理支付回调
        /// </summary>
        /// <param name="notifyData">回调数据</param>
        /// <returns>处理结果</returns>
        Task<bool> HandlePaymentNotifyAsync(string notifyData);

        /// <summary>
        /// 查询支付状态
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <returns>支付状态</returns>
        Task<PaymentQueryResult> QueryPaymentStatusAsync(string orderNo);

        /// <summary>
        /// 关闭支付订单
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <returns>是否成功</returns>
        Task<bool> ClosePaymentAsync(string orderNo);

        /// <summary>
        /// 申请退款
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <param name="refundAmount">退款金额</param>
        /// <param name="refundReason">退款原因</param>
        /// <returns>退款结果</returns>
        Task<RefundRecord> ApplyRefundAsync(string orderNo, decimal refundAmount, string refundReason);

        /// <summary>
        /// 处理退款回调
        /// </summary>
        /// <param name="notifyData">回调数据</param>
        /// <returns>处理结果</returns>
        Task<bool> HandleRefundNotifyAsync(string notifyData);

        /// <summary>
        /// 查询退款状态
        /// </summary>
        /// <param name="refundNo">退款单号</param>
        /// <returns>退款状态</returns>
        Task<RefundRecord?> QueryRefundStatusAsync(string refundNo);
    }
} 